@extends('linfeng.home.index')
@section('title','商品详情')

@section('first-home')
    <div class="row">
        <div id="bd" class="bd" >
            <div class="bd-wrap">
                <div class="body">
                    {{--右侧--}}
                    <div class="asides col-md-3 col-xs-3">
                        <div class="hot-list-wrap hot-list-style commonApi-wrap" style="display: block; zoom: 1;">
                            {{--标头--}}
                            <div class="hd hot-title">
                                <span class="title-icon"></span>
                                小说热门榜单
                            </div>
                            {{--榜单--}}
                            <div class="hot-list-content commonApi-inner">
                                {{--一条--}}
                                <div class="yd-ebook-items">
                                    <div class="yd-list-item" style="display: block;">
                                        <span class="item-num books-hot-num ">1.</span>
                                        <a class="books-title books-item log-xsend" href="" target="_blank" title="大爱晚成">大爱晚成</a>
                                    </div>
                                </div>
                                {{--一条--}}
                                <div class="yd-ebook-items">
                                    <div class="yd-list-item" style="display: block;">
                                        <span class="item-num books-hot-num ">2.</span>
                                        <a class="books-title books-item log-xsend" href="" target="_blank" title="大爱晚成">大爱晚成</a>
                                    </div>
                                </div>
                                {{--一条--}}
                                <div class="yd-ebook-items">
                                    <div class="yd-list-item" style="display: block;">
                                        <span class="item-num books-hot-num ">3.</span>
                                        <a class="books-title books-item log-xsend" href="" target="_blank" title="大爱晚成">大爱晚成</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="cms-block">
                            <div class="bd">
                                <a href="" class="mb10">
                                    <img src="{{asset('image/home/guangao2.jpg')}}" alt="">
                                </a>
                                <a href="" class="mb10">
                                    <img src="{{asset('image/home/guangao1.jpg')}}" alt="">
                                </a>
                            </div>
                        </div>
                    </div>
                    {{--左侧--}}
                    <div class="main col-md-8 col-xs-8">

                        {{--书简介--}}
                        <div class="mod doc-info">
                            <div class="bd" style="position: relative">
                                <div class="doc-info-bd clearfix" style="position: relative;z-index:1;height:268px;">
                                    {{--书的图片--}}
                                    <div class="cover-block">
                                        <div class="img-block mb20 ffk-able ffk-focus">
                                            <a class="doc-info-imglink go-read-page" href=""><span class="ffk-icon"></span>
                                                <img class="doc-info-img" style="width: 155px;height: 204px" src="{{asset('image/books/'.$book->bookicon)}}" alt="">
                                                <input type="hidden" value="{{$book->id}}" id="bid">
                                            </a>
                                        </div>
                                    </div>
                                    {{-- 打赏作者  --}}
                                    <div style="position: absolute;margin-top: 247px;margin-left: 12px;cursor: pointer"><p id="dashang">打赏作家消耗一书币</p>
                                    </div>
                                    <script>
                                        $(function() {
//                                            id="readin"
                                            $('#dashang').click(function () {
                                                $bid=$('#bid').val()
                                                $rid=$('#readin').val()
                                                if ($rid){
                                                $.ajax({
                                                    url: "{{url('home/dashang')}}",
                                                    data: 'bid='+$bid,
                                                    type: 'post',
                                                    success: function (data) {
                                                        if (data==111){
                                                            alert('感谢投食一书币')
                                                        }else{
                                                            alert('出错啦请联系过了员')
                                                        }
                                                    },
                                                    headers: {
                                                        {{--                        'X-CSRF-TOKEN' : '{{ csrf_token() }}',--}}
                                                        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                                                    },
                                                    error: function () {
                                                        alert('出错啦请联系过了员')
                                                    },
                                                    datatype: 'text'
                                                })
                                                }else{
                                                    alert('请先登入')
                                                }
                                            })

                                        })
                                    </script>

                                    {{--书的详情--}}
                                    <div class="content-block">
                                        {{--书名--}}
                                        <h1 class="book-title" title="下载免费章节">
                                            {{$book->bookname}}
                                            <span class="ebook-tips">电子书</span>&nbsp;&nbsp;&nbsp;
                                             {{--<span class="ebook-tips"><a href="{{url('home/ingo/'.$id)}}">下载</a></span>--}}
                                        </h1>
                                        <b style="margin-left: 36px"><a href="{{url('home/ingo/'.$id)}}">下载免费章节</a></b>
                                        @if(empty(count($nelcolers)))
                                        <input type="botton" class="btn btn-default" id="gocollers" value="加入收藏" style="width: 80px;margin-left: 33px;">
                                        @else
                                            <input type="botton" class="btn btn-default" id="" value="已收藏" style="width: 80px;margin-left: 33px;">
                                            @endif

                                        {{--作者信息--}}
                                        <script>
                                            $(function(){
                                                $('#gocollers').click(function(){
                                                    $readid=$('.readid').val();
                                                    $bid=$('#bid').val()
                                                    if($readid){
                                                        $.ajax({
                                                            url:"{{url('home/message/collers/go')}}",
                                                            data:'bid='+$bid,
                                                            type:'post',
                                                            success:function(data){
                                                                if (data==111){
                                                                    $('#gocollers').val('已收藏');
                                                                    alert('以加入收藏,可在个人中心查看')
                                                                }else{

                                                                    alert('您以收藏此书,无需再收藏')
                                                                }
                                                            },
                                                            error:function(){
                                                                alert('出错了请联系管理员')
                                                            },
                                                            headers: {
                                                                {{--                        'X-CSRF-TOKEN' : '{{ csrf_token() }}',--}}
                                                                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                                                            },
                                                            datatype:'text'
                                                        })
                                                    }else{
                                                        alert('未登入请先登入');
                                                    }
                                                })
                                            })
                                        </script>
                                        <meta name="_token" content="{!! csrf_token() !!}"/>
                                        <ul class="doc-info-org">
                                            <li class="doc-info-field doc-info-author">
                                                <span class="doc-info-label">作<span style="margin-left:12px">者：</span></span>
                                                <a href="" class="doc-info-field-val doc-info-author-link" target="_blank">{{$book->writername}}</a>
                                            </li>
                                            <li class="doc-info-field ">
                                                <span class="doc-info-label">用户点击量：</span>
                                                <a class="doc-info-field-val" href="" target="_blank">{{$book->scan}}</a>
                                            </li>
                                            <li class="box doc-info-field doc-info-tags">
                                                <span class="media doc-info-label">类<span style="margin-left:12px">行：</span></span>
                                                <a href="" class="tag-item doc-info-field-val mb5" target="_blank" title="科幻">
                                                    @if($book->cid==1)
                                                        玄幻
                                                    @elseif($book->cid==2)
                                                        科幻
                                                    @elseif($book->cid==3)
                                                        都市
                                                    @elseif($book->cid==4)
                                                        军事
                                                    @elseif($book->cid==5)
                                                        末日
                                                    @elseif($book->cid==6)
                                                        武侠
                                                    @elseif($book->cid==7)
                                                        爱情
                                                    @endif
                                                </a>
                                            </li>
                                        </ul>
                                        <div class="doc-info-price">
                                            <div class="doc-info-btn-wp doc-info-normal">

                                                {{--开始购买章节--}}
                                                <div class="goumai">
                                                    <div class="row goumaoparan" >
                                                        <form action="{{url('home/piddetails')}}" >
                                                            <input type="hidden" value="{{session('readid')}}" name="rid">
                                                            <input type="hidden" value="{{$id}}" name="bid">

                                                            @foreach($chapter as $k)
                                                                    <div class="col-lg-6 gozhang"><label>
                                                                   @if($book->free<$k->zhongshu)
                                                                   @if(count(session('books')))
                                                                   @if(in_array($k->zhongshu,session('books')))
                                                                       已购
                                                                       @else
                                                                   <input type="checkbox" value="{{$k->zhongshu}}" id="checkbox-id" name="zhang[]">
                                                                    @endif
                                                                    @else
                                                                    <input type="checkbox" value="{{$k->zhongshu}}" id="checkbox-id" name="zhang[]">
                                                                   @endif
                                                                   @else
                                                                       免费章节
                                                                   @endif

                                                                   第{{$k->zhongshu}}章:{{$k->chaptersname}}</label></div>
                                                           @endforeach
{{--                                                        {!! session('books') !!}--}}

                                                    </div>

                                                    <input type="hidden" id="readin" value="{{session('readid')}}">
                                                    <button type="button" id="linfeng_gozhang" class="btn btn-primary btn-xs vise">购买</button>
                                                </div>
                                                <div class="linfeng_mima" style="display:none">
                                                    <div style="    margin-top: 69px;margin-left: 31px;">请输入密码:<input type="password" name="pwd">
                                                     <input type="submit" style="margin-left: 100px;" class="btn btn-primary btn-xs vise" value="确认购买"></div>
                                                </div>
                                                </form>
                                                <script>
                                                    $(function(){
                                                        $('#linfeng_gozhang').click(function(){
                                                            $readin=$('#readin').val();
                                                            if(!$readin){
                                                                alert('请先登入')
                                                            }else{
                                                                $('.linfeng_mima').css('display','inline')
                                                            }
//                                                            var checkVal='';
//                                                            $("input[id='checkbox-id']:checkbox").each(function(){
//                                                                if($(this).attr('checked')){
//                                                                    checkVal+=$(this).val()+',';
//                                                                }
//                                                            })
////                                                            判断 name=fruit 组的复选框是否有被选中的选项：
//                                                              var flag=false;
//                                                            $("input[id='checkbox-id']:checkbox").each(function(){
//                                                                if($(this).attr('checked')){
//                                                                    flag=true;
//                                                                }
//                                                            })
//                                                            if(flag){
//                                                                alert('有被选中');
//                                                            }else{
//                                                                alert('没有选中任何选项');
//                                                            }
                                                        })
                                                        $('#dianji').click(function(){
                                                            if($('.goumai').css('display')=='none'){
                                                                $('.goumai').css('display','inline')
                                                            }else{
                                                                $('.goumai').css('display','none')
                                                            }
                                                        })
                                                    })
                                                </script>
                                                {{--结束购买章节--}}
                                                @if(!empty(session('success')))
                                                    {!! session('success') !!}
                                                @endif
                                                {{--价钱--}}
                                                <div class="price-info">
                                                    <span class="confirm-price"><span class="prefix">章节价格：</span><span class="numeric">{{floatval($book->price)}}币</span></span>
                                                </div>
                                                {{--开始阅读--}}
                                                <div class="btn-area">
                                                    <a href="{{url('home/article/'.$book->id)}}"><button type="button" class="btn btn-success">开始阅读</button></a>
                                                    <a  id="doc-add-cart" class="add-to-cart ">
                                                        <span class="ic ic-cart glyphicon glyphicon-bed"></span>
                                                        @if($book->free=='all')
                                                            <span class="txt"><b id="" style="cursor:pointer">本书为全免费书籍无需购买</b></span>
                                                        @else
                                                        <span class="txt"><b id="dianji" style="cursor:pointer">购买章节</b></span>
                                                            @endif
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {{--摘要--}}
                        <div class="roll-text-wrap">
                            <div class="roll-text-list">
                                <a class="roll-item" href="" target="_blank">
                                    <img class="roll-icon right" src="{{asset('image/home/icon1.jpg')}}" alt="">
                                    <div class="roll-area" style="top: 0px;">
                                        <ul class="roll-text-area next">
                                            <li class="roll-title" style="margin-top:18px;">出版社直接授权版权资源</li>
                                            <li class="roll-txt">全本无乱码、无错字</li>
                                        </ul>
                                    </div>
                                </a>
                                <a class="roll-item" href="" target="_blank">
                                    <img class="roll-icon right" src="{{asset('image/home/icon2.jpg')}}" alt="">
                                    <div class="roll-area" style="top: 0px;">
                                        <ul class="roll-text-area next">
                                            <li class="roll-title" style="margin-top:18px;">舒适不累的阅读体验</li>
                                            <li class="roll-txt">随时做书摘笔记</li>
                                        </ul>
                                    </div>
                                </a>
                                <a class="roll-item" href="" target="_blank">
                                    <img class="roll-icon right" src="{{asset('image/home/icon3.jpg')}}" alt="">
                                    <div class="roll-area" style="top: 0px;">
                                        <ul class="roll-text-area next">
                                            <li class="roll-title" style="margin-top:18px;">多个设备同步阅读</li>
                                            <li class="roll-txt">以支持电脑、手机、iPad等设备</li>
                                        </ul>
                                    </div>
                                </a>
                            </div>
                        </div>
                        {{--标签--}}
                        <div class="mod book-select active-fixTop">
                            <div class="hd select-title clearfix">
                                <a href="" class="select-item mr5 select-item-desp current" style="margin-left: 0;">
                                    <span class="select-item-border"></span>简介
                                </a>
                                <a href="" class="select-item mr5 select-item-cata">
                                    <span class="select-item-border"></span>目录
                                </a>
                                <a href="" class="select-item select-item-comment">
                                    <span class="select-item-border"></span>评论&nbsp;<span style="color:#999;">(23)</span>
                                </a>
                            </div>
                        </div>
                        {{--图书简介--}}
                        <div class="mod book-des book-intro-block" id="book-des">
                            <a name="desp" class="anchor anchor1" id="desp">&nbsp;</a>
                            <div class="new-title">
                                <span class="title-icon"></span>
                                <span class="title-txt">图书简介</span>
                            </div>
                            <div class="bd scaling-content-wp">
                                <div class="scaling-content">
                                    <p style="width:500px;  letter-spacing:4px;margin:4px 0 0 9px;">{{$book->desc}}</p>
                                </div>
                            </div>
                        </div>
                        {{--基本信息--}}
                        <div class="mod book-intro-block mb20">
                            <div class="new-title book-info-title">
                                <span class="title-icon"></span>
                                <span class="title-txt">基本信息</span>
                            </div>
                            <div class="bd">
                                <ul class="book-information clearfix">
                                    <li>
                                        <span class="book-information-tip">作者：</span>
                                        <a href="" class="" target="_blank">{{$book->writername}}</a>
                                        <input type="hidden" value="{{$book->id}}" id="bid">
                                    </li>
                                    <li>
                                        <span class="book-information-tip">版权方：</span>
                                        <span class="" href="" target="_blank">北京磨铁数盟信息技术有限公司</span>
                                    </li>
                                    <li class="book-information-classic book-information-tip">
                                        <span class="classic-type">分类：</span>
                                        <div class="crumbs-wp">
                                            <div id="page-curmbs" class="crumbs uis-crumbs">
                                                <ul  class="clearfix">
                                                    <span class="glyphicon glyphicon-menu-right"></span>
                                                    <a> @if($book->cid==1)
                                                            玄幻
                                                        @elseif($book->cid==2)
                                                            科幻
                                                        @elseif($book->cid==3)
                                                            都市
                                                        @elseif($book->cid==4)
                                                            军事
                                                        @elseif($book->cid==5)
                                                            末日
                                                        @elseif($book->cid==6)
                                                            武侠
                                                        @elseif($book->cid==7)
                                                            爱情
                                                        @endif</a></a>
                                                </ul>
                                            </div>
                                        </div>
                                    </li>
                                    <li>
                                        <span class="book-information-tip">出版社：</span>
                                        <span    class="">北京联合出版公司</span>
                                    </li>
                                    <li>
                                        <span class="book-information-tip">出版时间：</span>
                                        <span    class="">{{date('Y-m-d',$book->addtime)}}</span>
                                    </li>
                                    <li>
                                        <span class="book-information-tip">纸定书架：</span>
                                        <span    class="">40</span><span>元</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        {{--目录--}}
                        <div class="mod doc-catalog mb20">
                            <a name="cata" class="anchor anchor1" id="cata">&nbsp;</a>
                            <div class="new-title" style="border-bottom:1px solid #A6A6A6;">
                                <span class="title-txt" style="margin:0;">目录（共{{$book->chapterssum}}章）</span>
                            </div>
                            <div class="bd scaling-content-wp">
                                <div class="cata-content scaling-contents">
                                    @foreach($rolls as $k)
                                        <ul class="catalog-list" id="catalog-list" style="padding:0px;overflow:hidden;">
                                            <li class="level1">
                                                <div class="new-title">
                                                    <span class="title-icon" style="top:10px;"></span>
                                                    <span class="title-txt" id="test" style="cursor: pointer"><input type="hidden" value="{{$k->id}}">第{{$k->bookrollssum}}卷: {{$k->bookrollsname}}</span>
                                                </div>
                                            </li>
                                            {{--<li class="level2">--}}
                                            {{--<span class="catalog-item disabled-item" title="" >--}}
                                            {{--<a href=""><span class="catalog-title">第一章</span></a>--}}
                                            {{--</span>--}}
                                            {{--</li>--}}
                                            {{--<li class="level2">--}}
                                            {{--<span class="catalog-item disabled-item" title="" >--}}
                                            {{--<a href=""><span class="catalog-title">第二章</span></a>--}}
                                            {{--</span>--}}
                                            {{--</li>--}}
                                            {{--<li class="level2">--}}
                                            {{--<span class="catalog-item disabled-item" title="" >--}}
                                            {{--<a href=""><span class="catalog-title">第三章</span></a>--}}
                                            {{--</span>--}}
                                            {{--</li>--}}
                                            {{--<li class="level2">--}}
                                            {{--<span class="catalog-item disabled-item" title="" >--}}
                                            {{--<a href=""><span class="catalog-title">第四章</span></a>--}}
                                            {{--</span>--}}
                                            {{--</li>--}}
                                            {{--<li class="level2">--}}
                                            {{--<span class="catalog-item disabled-item" title="" >--}}
                                            {{--<a href=""><span class="catalog-title">第五章</span></a>--}}
                                            {{--</span>--}}
                                            {{--</li>--}}
                                        </ul>
                                    @endforeach
                                </div>
                                <p class="scaling-more-btn" id="catalog-btn" style="display: block;margin-bottom:50px;">
                                    <a href="" style="float:right;" class="expand"><span class="text"></span>
                                        <span class="glyphicon glyphicon-menu-down"></span>
                                    </a>
                                </p>
                            </div>
                        </div>
                        {{--图书评论--}}
                        <div class="mod book-score">
                            <div class="new-title">
                                <span class="title-txt">图书评论</span>
                            </div>
                            <div class="recommend-course">
                                <div class="article-box">
                                    <div id="item">
                                        <ul style="padding:0;margin:0;">
                                            @if(count($comment))
                                                @foreach($comment as $k)
                                                    <li class="comment-list-item">
                                                        <div class="items">
                                                            <div class="article-bottom">
                                                <span class="author pic32">
                                                    <span class="circle">
                                                        <img src="{{asset('image/home/special-bj.png')}}">
                                                    </span>
                                                    <img src="{{asset('image/home/'.$k->icon)}}">
                                                </span>
                                                            </div>
                                                            <div class="comment-info clearfix no-margin-top">
                                                <span class="comment-author">
                                                    {{$k->readname}}
                                                    <span>【购买用户】</span>
                                                </span>
                                                                <span class="comment-date">2016-08-06 19:47:23</span>
                                                                <span class="comment-from">来自人生书屋</span>
                                                            </div>
                                                            {{--评论留言--}}
                                                            <p class="comment-area">{{$k->comment}}</p>
                                                            {{--回复--}}
                                                            <div class="comment-ft">
                                                                {{--<a href="" class="btn-reply ">--}}
                                                                <span class="reply-change" style="cursor: pointer" id="">回复</span>&nbsp;&nbsp;
                                                                <span class="reply-change" style="cursor: pointer" id="zhan">赞<input type="hidden" value="{{$k->id}}"></span>&nbsp;&nbsp;

                                                                <span class="glyphicon glyphicon-heart-empty" style="color:red;" id="sess"><input
                                                                            type="hidden" id="sessionid" value="{{session('readid')}}"></span>
                                                                <span class="like-numarea" id="sum">
                                                        <span class="like-num">{{$k->good}}</span>
                                                    </span>
                                                                {{--</a>--}}
                                                            </div>
                                                        </div>
                                                    </li>
                                                @endforeach
                                            @else
                                                <li class="comment-list-item">
                                                    <div class="items">
                                                        <div class="article-bottom">
                                                <span class="author pic32">
                                                    <span class="circle">

                                                        {{--<img src="{{asset('image/home/special-bj.png')}}">--}}
                                                    </span>
                                                    {{--<img src="{{asset('image/home/a6.jpg')}}">--}}
                                                </span>
                                                        </div>
                                                        <div class="comment-info clearfix no-margin-top">
                                                <span class="comment-author">
                                                    {{--用户名--}}
                                                    {{--<span>【购买用户】</span>--}}
                                                    <h2>目前没有评论</h2>
                                                    {{--</span>--}}
                                                    {{--<span class="comment-date">2016-08-06 19:47:23</span>--}}
                                                    {{--<span class="comment-from">来自人生书屋</span>--}}
                                                    {{--</div>--}}
                                                    {{--评论留言--}}
                                                    {{--<p class="comment-area">场面不如三体恢宏，但自有其感人至深之处。 大善与大恶本就是一个硬币的两面，就看对谁而言了，但如何保护自己，保护人类， 这是刘慈欣和王晋康两位共同的思索，也许有一天，人类真的必须面对全人类的共同敌人 ，会是哪一天呢？</p>--}}
                                                    {{--回复--}}
                                                    {{--<div class="comment-ft">--}}
                                                    {{--<a href="" class="btn-reply ">--}}
                                                    {{--<span class="reply-change">回复</span>--}}
                                                    {{--</a>--}}
                                                    {{--<a href="" class="comment-like j_comment-like" data-id="462243">--}}
                                                    {{--<span class="glyphicon glyphicon-heart-empty" style="color:red;"></span>--}}
                                                    {{--<span class="like-numarea">--}}
                                                    {{--<span class="like-num">0</span>--}}
                                                    </span>
                                                            {{--</a>--}}
                                                        </div>

                                                    </div>

                                                </li>
                                            @endif
                                        </ul>

                                    </div>
                                </div>
                            </div>
                        </div>
                        {{--发表评论--}}
                        <div class="mod comment mb20">
                            <a name="write-comment" class="anchor anchor1" id="write-comment">&nbsp;</a>
                            <div class="hd"></div>
                            <div class="bd">
                                <div class="new-title">
                                    <span class="title-txt">发表评论</span>
                                </div>
                                <div class="uncomment">
                                    <div class="user-icon-wp">
                                        <div class="article-bottom">
                                                <span class="author pic32">
                                                    <img src="{{url('image/home/icon6.png')}}">
                                                </span>
                                        </div>
                                    </div>
                                    <div class="comment-sub comment-sub-disabled">
                                        <div class="clearfix comment-sub-wp">
                                            {{--<span>标题</span>--}}
                                            {{--<input type="text" class="comment-title-sub not-comment-title" placeholder="选填" maxlength="30" >--}}
                                        </div>
                                        <form action="" method="post">
                                            {{csrf_field()}}
                                            <div class="clearfix comment-sub-wp">
                                                <span>正文</span>
                                                <textarea class="comment-content-sub not-comment-content" name="text"></textarea>
                                                <input type="hidden" name="readid" value="{{session('readid')}}">
                                                <input type="hidden" name="readname" class="readid" value="{{session('readname')}}">
                                                <input type="hidden" name="bookid" value="{{$book->id}}">
                                                <input type="hidden" name="bookname" value="{{$book->bookname}}">
                                            </div>
                                    </div>
                                    <div class="comment-sub-btn-wp">
                                        @if(session('readid'))
                                            <input type="submit"  class="btn btn-info" value="发表评论">
                                        @else
                                            <a href="" class="not-login-tips">登录后可评论</a>
                                        @endif
                                        <span class="comment-sub-error c_comment-sub-error"></span>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {{--              点赞                       --}}
    <script>
        $(function(){
            $(this).on('click','#zhan',function(){

                $rid=$('#sessionid').val()

                if($rid){
                    $bid=$('#bid').val();
                    $sum=$(this).siblings('#sum').children().html();
                    $cid=$(this).children('input').val()

                    $sum=$(this).siblings('#sum').children().html();


                    $new=$(this).siblings('#sum').children();
                    $zhan=$(this);
//                        $zhan=$(this).empty();
//                    alert($cid)
                    $.ajax({
                        url:'{{url('home/comment')}}',
                        data:'cid='+$cid+'&rid='+$rid+'&bid='+$bid,
                        type:'get',
                        success:function(data){
                            if (data){
                                alert('您已经点赞过了')
                            }else{
                                $sum=Number($sum)+Number(1);
//                                alert($sum)
                                $new.html($sum);
//                                alert($new);
                                $zhan.empty();
                            }

                        },
                        error:function(){
                            alert('失败');
                        },
                        dataType:'text'
                    })
                }else{
                    alert('请先登入')
                }
            })
        })
    </script>

    {{--       书卷的选中出选中书涨        --}}
    <script>
        $(function(){
            $(this).on('click','#test',function(){
                $rid=$(this).children('input').val();
//                $('#che > li').empty();
//                $rid=$('#sessionid').val()
                $.ajax({
                    url:"{{url('home/chapters')}}",
                    data:'get',
                    data:'rid='+$rid,
                    success:function(data){
                        $cha=$.makeArray(data);
                        if($cha){
                            $('#docha > ul').empty();
                        }
                        for(var i=0;i<$cha.length+1;i++){
                            $bid=$('#bid').val();
                            $('#docha').append('<ul><a href="{{url('home/message/into/')}}/'+$bid+'\/0\/'+$cha[i].zhongshu+'"><li>第'+$cha[i].zhongshu+'章:  '+$cha[i].chaptersname+'</li></a></ul>')
                        }
//                        $('#cha > li').empty();
                    },
                    error:function(){
                        alert('失败');
                    },
                    dataType:'json'
                })
            })
        })
    </script>

    {{--   模态框   --}}
    <div class="">
        {{--<button class="btn btn-primary" type="button" id="test">点击我显示模态框</button>--}}

        <div class="modal" id="my-modal-alert">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">
                            <span aria-hidden="true">&times</span><span class="sr-only">Close</span>
                        </button>
                        <h4 class="modal-title" id="modal-title">章节</h4><span id="num"></span>
                    </div>
                    <!--/*modal-header*/-->
                    <div class="modal-body">
                        <form action="{{url('huweize/writer/book/addbookrolls')}}" method="post">
                            {{csrf_field()}}
                            <div id="modal_message">
                                <div id="docha">

                                </div>

                                {{--                                <input type="hidden" value="{{$result->id}}" name="bid">--}}
                                {{--<input type="text" placeholder="卷名" name="bookrollsname"><br>--}}
                                {{--<textarea class="form-control" rows="2"  placeholder="卷介绍" name="desc"></textarea>--}}
                            </div>

                    </div>
                    <!--/*modal-body*/-->
                    <div class="modal-footer" id="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <!--/*modal-body*/-->
                        </form>
                    </div>
                    <!--/*modal-footer*/-->
                </div>
                <!--/*modal-dialog*/-->
            </div>
            <!--/*modal-content*/-->
        </div>
        <!--/*modal*/-->
        <script>
            $(function() {
                $(this).on('click','#test',function(){
                    $("#my-modal-alert").modal("toggle");

                    $(".modal-backdrop").remove();//删除class值为modal-backdrop的标签，可去除阴影
                });
            });
        </script>
    </div>


@endsection